<template>
  <div>
	 

	  <el-tag size="mini">待诊</el-tag>
	
	  <el-table :data="tableData1" size="mini"  style="width: 100%" @row-click="rowClick" >
	  	<el-table-column label="病历号"  prop="id">
	  	</el-table-column>
	  	
	  	<el-table-column label="患者名称" prop="name">
	  	</el-table-column>
	  </el-table>
	  
	 <el-tag size="mini">已诊</el-tag>
	 
	 
	 <el-table :data="tableData2" size="mini"  style="width: 100%"  @row-click="rowClick">
	
	 	<el-table-column label="病历号"  prop="id">
	 	</el-table-column>
	 	
	 	<el-table-column label="患者名称" prop="name">
	 	</el-table-column>
	 	
	 </el-table>
	 
  
  
  </div>
</template>

<script>
  export default {
    name: 'RegisterList',
	//registType 1 本人 ,2 科室
	props:['registType'],
    components: {

    },
    data() {
      return {
		  registList:[] //所有 的 患者信息
      }
    },
    methods: {

		queryRegistList(){
			this.axios.get('/register?type=listAll',(data)=>{
				this.registList = data;
			},{
				registType:this.registType
			})
		},
		rowClick(row, column, event){
			//console.log(row);
			this.$emit("selectRegister",row)
		}

    },
	computed:{
		//计算属性， 根据 状态查找status 1
		tableData1(){
			let list  = [];
			for (var i = 0; i < this.registList.length; i++) {
				if(this.registList[i].status == 1){
					list.push(this.registList[i]);
				}
			}
			
			return list;
		},
		tableData2(){
			let list  = [];
			for (var i = 0; i < this.registList.length; i++) {
				if(this.registList[i].status == 2){
					list.push(this.registList[i]);
				}
			}
			return list;
		}
	},
    created() {
		this.queryRegistList();
	}
	
	
  }
</script>

<style>
</style>
